<div class="form">

    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'member-form',
        'enableAjaxValidation' => false,
    ));
    ?>
    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>

    <div class="row">
        <?php echo $form->labelEx($model, 'first_name'); ?>
        <?php echo $form->textField($model, 'first_name', array('size' => 60, 'maxlength' => 255)); ?>
        <?php echo $form->error($model, 'first_name'); ?>
    </div>
    
    <div class="row">
        <?php echo $form->labelEx($model, 'username'); ?>
        <?php echo $form->textField($model, 'username', array('size' => 60, 'maxlength' => 255)); ?>
        <?php echo $form->error($model, 'username'); ?>
    </div>
    
    <div class="row">
        <?php echo $form->labelEx($model, 'password'); ?>
        <?php echo $form->textField($model, 'password', array('size' => 60, 'maxlength' => 255)); ?>
        <?php echo $form->error($model, 'password'); ?>
    </div>
    
    <div class="row">
        <?php echo $form->labelEx($model, 'email'); ?>
        <?php echo $form->textField($model, 'email', array('size' => 60, 'maxlength' => 255)); ?>
        <?php echo $form->error($model, 'email'); ?>
    </div>
    
    <div class="row agree">
        <?php echo $form->labelEx($model, 'status'); ?>
        <?php echo $form->checkBox($model, 'status', array('size' => 1, 'maxlength' => 1)); ?>
        <?php echo $form->error($model, 'status'); ?>
    </div>

    <div class="row agree">
        <?php echo $form->labelEx($model, 'active'); ?>
        <?php echo $form->checkBox($model, 'active', array('size' => 1, 'maxlength' => 1)); ?>
        <?php echo $form->error($model, 'active'); ?>
    </div>
    
    <div class="row agree">
        <?php echo $form->labelEx($model, 'test_account'); ?>
        <?php echo $form->checkBox($model, 'test_account', array('size' => 1, 'maxlength' => 1)); ?>
        <?php echo $form->error($model, 'test_account'); ?>
    </div>
    
    <div class="row agree">
        <?php echo $form->labelEx($model, 'member_type'); ?>
        <?php echo $form::dropDownList($model, 'member_type', 
              array('A' => 'A', 'B' => 'B'), array('empty' => '---Select a type---'));?>
        <?php echo $form->error($model, 'member_type'); ?>
    </div>
    
    <div class="row agree">
        <?php echo $form->labelEx($model, 'parent_id'); ?>
        <?php 
        $list = CHtml::listData(Member::model()->findAll("status=:status AND active=:active", array("status" => '1', "active" => '1')), 'member_id', 'username');
            echo $form->dropDownList($model, 'parent_id', $list, array(
                'empty'    => '---Select Referral User---',
            ));?>
        <?php echo $form->error($model, 'parent_id'); ?>
    </div>
    
    <div class="row agree">
        <?php echo $form->labelEx($model, 'package_id'); ?>
        <?php 
        $packageList = CHtml::listData(Package::model()->findAll(), 'package_id', 'name');
            echo $form->dropDownList($model, 'package_id', $packageList, array(
                'empty'    => '---Select Package---',
            ));?>
        <?php echo $form->error($model, 'package_id'); ?>
    </div>
    
    

    <?php if($model->username != 'admin'){ ?>
    <div class="row buttons">
        <?php echo CHtml::submitButton(($model->member_id != null)? 'Save' : 'Create'); ?>
    </div>
    <?php } ?>
    <?php $this->endWidget(); ?>

</div><!-- form -->